package org.pz.camunda.enums;

import lombok.AllArgsConstructor;
import lombok.Data;

import javax.validation.constraints.NotNull;

/**
 * 操作枚举
 * */
@AllArgsConstructor
@NotNull
public enum OperateTypeEnum {

    START(0, "发起"),
    AGREE(1, "同意"),
    DISAGREE(2, "驳回"),
    RESTART(3, "重新发起");

    private int code;
    private String name;

    public static String getName(int code) {
        for (OperateTypeEnum operateTypeEnum : OperateTypeEnum.values()) {
            if(operateTypeEnum.code == code) {
                return operateTypeEnum.name;
            }
        }
        throw new RuntimeException("未获取到制定操作");
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
